package cn.myjerry.sort.col;

import java.util.TreeSet;

public class TreeSetDemo3 {
	public static void main(String[] args) {
		Student s1 = new Student(1001, "Jerry", 80);
		Student s2 = new Student(1002, "Tom", 100);
		Student s3 = new Student(1003, "Devy", 50);
		
		TreeSet<Student> students = new TreeSet<Student>(
					new java.util.Comparator<Student>(){
						@Override
						public int compare(Student o1, Student o2) {
							return -(o1.getScore()>o2.getScore()?1:(o1.getScore()==o2.getScore()?0:-1));
						}						
					}
				);
		students.add(s1);
		students.add(s2);
		students.add(s3);
		System.out.println(students);
	}
}
